Skip to content

fix: make client-owned web fetch discoverable (#252) - #263

Open
ankitranjan7 wants to merge 1 commit into
mainfrom
fix/252-web-fetch-discoverability
Open

fix: make client-owned web fetch discoverable (#252)#263
ankitranjan7 wants to merge 1 commit into
mainfrom
fix/252-web-fetch-discoverability

Conversation

@ankitranjan7

@ankitranjan7 ankitranjan7 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #252.

The problem

webcmd web fetch always works, but the CLI never tells you it exists.

The command is intercepted on the client-owned fast path in src/main.ts:79, before adapter discovery — so it runs on a fresh install with zero plugins. It just isn't listed anywhere, and asking for help throws:

$ webcmd --help                       # no `web` under Commands or Site adapters
$ webcmd list                         # no web fetch
$ webcmd list -f json                 # 0 entries with "site": "web"
$ webcmd --get-completions webcmd web # (empty)
$ webcmd web fetch --help
ArgumentError: --url must be an http or https URL

So the only way to discover a built-in command is to already know it.

What I changed

  1. clis/web/fetch.js — registers the command through a new makeWebFetchCommand() factory, so both build-manifest and the runtime filesystem scan pick it up.
  2. src/discovery.ts — the module pattern now matches make<Pascal>Command(, the same convention src/build-manifest.ts:48 already used.
  3. cli-manifest.json — gains the generated web/fetch entry. It regenerates byte-identical, check:hosted-contract passes, and hosted-contract.json is unchanged because this command is not browser-based.
  4. src/fetch/command.ts — now that help is real, the fast path honours what it advertises: -f/--format for output (markdown still the default), structured --help -f yaml|json, an error on an unsupported format instead of silently falling back to a table, and an error when --timeout/--max-chars is given a flag-shaped value instead of quietly coercing it to 1.

The fast path itself stays exactly where it was — execution never touches the registry, so hosted mode still never cloud-routes this command.

Proof

Surface Before After
webcmd --help no web web under Site adapters
webcmd list absent fetch [public] … [builtin]
webcmd list -f json absent full entry with all four args
webcmd web fetch -h ArgumentError real help
webcmd --get-completions web '' empty fetch, fetch-browser

Verified against a rebuilt dist. Four new tests in src/fetch/command.test.ts cover the -f output path, structured help, the format rejection and the --timeout -5 rejection. Full suite passes except tests/e2e/plugin-management.test.ts, which clones plugins over the network and fails identically on main (fixed separately in #267).

Not in this PR

🤖 Generated with Claude Code

`web fetch` always worked via the main.ts fast path but was invisible to
`--help`, `list`, `cli-manifest.json`, and completions unless the `web`
plugin was installed, and `web fetch -h` threw instead of printing help.

Register the command from clis/web/fetch.js via a makeWebFetchCommand()
factory so build-manifest and filesystem discovery both see it, and keep
execution on the fast path so hosted mode never cloud-routes it.

The fast path now honours the flags its help advertises: -f/--format for
output and structured --help, an error for unsupported formats, and an
error for a flag-shaped --timeout/--max-chars value instead of coercing
it to 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🟠 Maintainer review suggested — low confidence

The automated review could not reach a fully supported conclusion.

This review is advisory and does not block merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webcmd web fetch is invisible to --help, list, completions, and -h despite always being available

1 participant